package com.liqi.web.controller.office;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.liqi.common.annotation.Log;
import com.liqi.common.core.controller.BaseController;
import com.liqi.common.core.page.TableDataInfo;
import com.liqi.common.enums.BusinessType;
import com.liqi.common.utils.poi.ExcelUtil;
import com.liqi.office.domain.TRunService;
import com.liqi.office.domain.TRunServiceRequest;
import com.liqi.office.domain.TRunServiceRequestDto;
import com.liqi.office.service.TRunServiceRequestService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;


@Api(tags = "办件")
@RestController
@RequestMapping("/office")
public class TRunServiceRequestContorller  extends BaseController {
	
    @Autowired
    TRunServiceRequestService runServiceRequestService;
    
    @ApiOperation("办件查询")
    @GetMapping({"/getBackHistory"})
    public TableDataInfo getBackHistory(TRunServiceRequestDto tRunServiceRequestDto) {
        startPage();
        List<TRunServiceRequest> list = runServiceRequestService.getServiceRequestBack(tRunServiceRequestDto);
        return getDataTable(list);
    }
    
    
//    /**
//     * 导出事项统计点击数列表
//     */
//    @ApiOperation("办件查询导出")
//    @PostMapping("/BackHistoryexport")
//    public void BackHistoryexport(HttpServletResponse response, TRunServiceRequestDto tRunServiceRequestDto)
//    {
//        List<TRunServiceRequest> list = runServiceRequestService.getServiceRequestBack(tRunServiceRequestDto);
//        ExcelUtil<TRunServiceRequest> util = new ExcelUtil<TRunServiceRequest>(TRunServiceRequest.class);
//        util.exportExcel(response, list, "办件查询数据");
//    }
    
    
    /**
     * 查询事项统计点击数列表
     */
    @ApiOperation("事项点击统计查询")
    @GetMapping("/list")
    public TableDataInfo list(TRunServiceRequest tRunServiceRequest)
    {
        startPage();
        List<TRunServiceRequest> list = runServiceRequestService.getServiceRequestStatistics(tRunServiceRequest);
        return getDataTable(list);
    }

    /**
     * 导出事项统计点击数列表
     */
    @ApiOperation("事项点击统计导出")
    @Log(title = "事项统计点击数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TRunServiceRequest tRunServiceRequest)
    {
        List<TRunServiceRequest> list = runServiceRequestService.getServiceRequestStatistics(tRunServiceRequest);
        ExcelUtil<TRunServiceRequest> util = new ExcelUtil<TRunServiceRequest>(TRunServiceRequest.class);
        util.exportExcel(response, list, "事项统计点击数数据");
    }
}
